//
//  StorageTest.m
//  iSeeColor
//
//  Created by Wyatt Gosling on 10/20/12.
//  Copyright (c) 2012 Wyatt Gosling. All rights reserved.
//

#import <objc/runtime.h>
#import "StorageTest.h"
#import "../iSeeColor/LocalStorage.h"
#import "../iSeeColor/Dropbox.h"
#import "../iSeeColor/iCloud.h"

@implementation StorageTest

-(void) test_getInstanceWithNil
{
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"storage location"];
    Storage* instance = [Storage getInstance];
    STAssertTrue( [instance isKindOfClass:[LocalStorage class]], @"Got: %@; Want: LocalStorage", NSStringFromClass([instance class]) );
    STAssertNotNil( [[NSUserDefaults standardUserDefaults] stringForKey:@"storage location"], @"Storage location should get set in NSUserDefaults." );
}

-(void) test_getInstanceWithLocal
{
    [[NSUserDefaults standardUserDefaults] setObject:@"local" forKey:@"storage location"];
    Storage* instance = [Storage getInstance];
    STAssertTrue( [instance isKindOfClass:[LocalStorage class]], @"Got: %@; Want: LocalStorage", NSStringFromClass([instance class]) );
}

-(void) test_getInstanceWithDropbox
{
    [[NSUserDefaults standardUserDefaults] setObject:@"dropbox" forKey:@"storage location"];
    Storage* instance = [Storage getInstance];
    STAssertNotNil( instance, @"hi" );
    STAssertTrue( [instance isKindOfClass:[Dropbox class]], @"Got: %@; Want: Dropbox", NSStringFromClass([instance class]) );
}


-(void) test_getInstanceWithiCloud
{
    [[NSUserDefaults standardUserDefaults] setObject:@"icloud" forKey:@"storage location"];
    Storage* instance = [Storage getInstance];
    STAssertTrue( [instance isKindOfClass:[iCloud class]], @"Got: %@; Want: iCloud", NSStringFromClass([instance class]) );
}

@end
